We introduce a stepping methodology for answer-set programming (ASP) thatallows for debugging answer-set programs and is based on the stepwiseapplication of rules. Similar to debugging in imperative languages, where thebehaviour of a program is observed during a step-by-step execution, steppingfor ASP allows for observing the effects that rule applications have in thecomputation of an answer set. While the approach is inspired from debugging inimperative programming, it is conceptually different to stepping in otherparadigms due to non-determinism and declarativity that are inherent to ASP. Inparticular, unlike statements in an imperative program that are executedfollowing a strict control flow, there is no predetermined order in which toconsider rules in ASP during a computation. In our approach, the user is freeto decide which rule to consider active in the next step following his or herintuition. This way, one can focus on interesting parts of the debugging searchspace. Bugs are detected during stepping by revealing differences between theactual semantics of the program and the expectations of the user. As a solidformal basis for stepping, we develop a framework of computations foranswer-set programs. For fully supporting different solver languages, we buildour framework on an abstract ASP language that is sufficiently general tocapture different solver languages. To this end, we make use of abstractconstraints as an established abstraction for popular language constructs suchas aggregates. Stepping has been implemented in SeaLion, an integrateddevelopment environment for ASP. We illustrate stepping using an examplescenario and discuss the stepping plugin of SeaLion. Moreover, we elaborate onmethodological aspects and the embedding of stepping in the ASP developmentprocess.
展开▼